from django.contrib.auth.models import User
from django.db import models
from django.utils.timezone import now


class ChatGroup(models.Model):
	name = models.CharField(max_length=25)
	password = models.CharField(max_length=20)
	introduce = models.CharField(max_length=200)


class Report(models.Model):
	chatgroup = models.ForeignKey(ChatGroup, on_delete=models.CASCADE)
	username = models.TextField()
	value = models.TextField()
	date = models.DateTimeField(default=now)
	
	def __str__(self):
		return self.value


class Member(models.Model):
	owner = models.ForeignKey(User, on_delete=models.CASCADE)
	group = models.ForeignKey(ChatGroup, on_delete=models.CASCADE)
